package leecode

func checkInclusionLCR(s1 string, s2 string) bool {
	if len(s1) > len(s2) {
		return false
	}
	s1Arr, s2Arr := [26]uint{}, [26]uint{}
	for i := 0; i < len(s1); i++ {
		s1Arr[s1[i]-'a']++
		s2Arr[s2[i]-'a']++ //初始化窗口
	}
	if s1Arr == s2Arr {
		return true
	}
	for right := len(s1); right < len(s2); right++ {
		s2Arr[s2[right]-'a']++
		s2Arr[s2[right-len(s1)]-'a']--
		if s1Arr == s2Arr {
			return true
		}
	}
	return false
}
